package com.example.tooltip_view;

import com.venmo.view.TooltipView;
import junit.framework.TestCase;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class TooltipViewTest extends TestCase {

    private Context context;
    private TooltipView tooltipView;

    @Before
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        tooltipView = new TooltipView(context);
    }

    @Test
    public void testSetAndGetBackgroundColor() {
        int color = 0xFFFFFFFF;
        tooltipView.setTooltipColor(color);
        int bgColor = tooltipView.getTooltipColor();
        Assert.assertEquals(color, bgColor);
    }

    @Test
    public void testSetAndGetArrowHeight() {
        int arrowHeight = 20;
        tooltipView.setArrowHeight(arrowHeight);
        int height = tooltipView.getArrowHeight();
        Assert.assertEquals(arrowHeight, height);
    }

    @Test
    public void testSetAndGetArrowWidth() {
        int arrowWidth = 30;
        tooltipView.setArrowWidth(arrowWidth);
        int width = tooltipView.getArrowWidth();
        Assert.assertEquals(arrowWidth, width);
    }

    @Test
    public void testSetAndGetCornerRadius() {
        int cornerRadius = 10;
        tooltipView.setCornerRadius(cornerRadius);
        int radius = tooltipView.getCornerRadius();
        Assert.assertEquals(cornerRadius, radius);
    }

    @Test
    public void testSetAndGetAnchoredViewId() {
        int anchoredViewId = 10239;
        tooltipView.setAnchoredViewId(anchoredViewId);
        int viewId = tooltipView.getAnchoredViewId();
        Assert.assertEquals(anchoredViewId, viewId);
    }

    @Test
    public void testSetAndGetAlignmentOffset() {
        int alignmentOffset = 1;
        tooltipView.setAlignmentOffset(alignmentOffset);
        int offSet = tooltipView.getAlignmentOffset();
        Assert.assertEquals(alignmentOffset, offSet);
    }
}
